class Solution(object):
    def generate(self, numRows):
        if numRows == 0:
            return []
        if numRows == 1:
            return [[1]]
        if numRows == 2:
            return [[1],[1,1]]
        res = [[1],[1,1]]
        for i in range(numRows-2):
            a = res[-1] + [0]
            b = [0] + res[-1]
            c = [x+y for (x,y) in zip(a,b)]
            res.append(c)
        return res
